<%--
  Created by IntelliJ IDEA.
  User: ytqint
  Date: 2018/11/12
  Time: 11:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>统计项设置</title>
    <%@ include file="../common/meta.jsp" %>
    <%@ include file="../common/common-body.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
    <style>
        .model-c-label{
            text-align: center;
        }
        #_noCheckBtn{
            display: none;
        }
    </style>
    <script>
        var userType = '${userType}';
        var searchInfo = ${searchInfo};
    </script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="tabs-container">
        <ul class="nav nav-tabs">
            <c:if test="${not empty searchInfo && searchInfo.isPvExist == 1}">
                <li>
                    <a href="${ctx}/pvuv/pvuvStat/pvPage?isPvExist=${not empty searchInfo ? searchInfo.isPvExist : 1}&isUvExist=${not empty searchInfo ? searchInfo.isUvExist : 1}&isStatExist=${not empty searchInfo ? searchInfo.isStatExist : 1}" aria-expanded="true">PV统计</a>
                </li>
            </c:if>
            <c:if test="${not empty searchInfo && searchInfo.isUvExist == 1}">
                <li>
                    <a href="${ctx}/pvuv/pvuvStat/uvPage?isPvExist=${not empty searchInfo ? searchInfo.isPvExist : 1}&isUvExist=${not empty searchInfo ? searchInfo.isUvExist : 1}&isStatExist=${not empty searchInfo ? searchInfo.isStatExist : 1}" aria-expanded="true">UV统计</a>
                </li>
            </c:if>
            <c:if test="${not empty searchInfo && searchInfo.isStatExist == 1}">
                <li class="active">
                    <a href="${ctx}/pvuv/statSeedBiz/page?isPvExist=${not empty searchInfo ? searchInfo.isPvExist : 1}&isUvExist=${not empty searchInfo ? searchInfo.isUvExist : 1}&isStatExist=${not empty searchInfo ? searchInfo.isStatExist : 1}" aria-expanded="true">统计项控制</a>
                </li>
            </c:if>
        </ul>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>筛选查询</h5>
                </div>
                <div class="ibox-content ibox-content-search">
                    <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">埋点类型：</label>
                            <div class="col-sm-2">
                                <select class="form-control" name="seedType" id="seedType" onclick="doRefresh()">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${seedTypeMap}" var="item">
                                        <option value="${item.code}" ${not empty searchInfo && searchInfo.seedType == item.code? 'selected' : '' }>${item.name}</option>
                                    </c:forEach>
                                </select>
                            </div>
                            <label class="col-sm-1 control-label">seed是否监控：</label>
                            <div class="col-sm-2">
                                <select class="form-control" name="isStat" id="isStat" onclick="doRefresh()">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${YNMap}" var="item">
                                        <option value="${item.key}" ${not empty searchInfo && searchInfo.isStat == item.key? 'selected' : '' }>${item.value}</option>
                                    </c:forEach>
                                </select>
                            </div>
                            <label class="col-sm-1 control-label">查询seed名称：</label>
                            <div class="col-sm-2">
                                <input type="text" name="seedName" onkeydown="if(event.keyCode==13){doRefresh();return false;}" id="seedName" class="form-control"
                                       placeholder="请输入seed名称" maxlength="30" value="${not empty searchInfo.seedName?searchInfo.seedName : ''}">
                            </div>
                            <div class="ibox-tools ibox-tools-search">
                                <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询</button>
                                <button type="button" class="btn btn-primary btn-outline" onclick="clearFrom('searchForm')">重置</button>
                                <button type="button" class="btn btn-primary btn-outline" onclick="openSearchTools();"><i class="fa fa-caret-down"></i></button>
                            </div>
                        </div>
                        <div class="search-tools">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">biz是否监控：</label>
                                <div class="col-sm-2">
                                    <select class="form-control" name="isStatBiz" id="isStatBiz" onclick="doRefresh()">
                                        <option value="">--请选择--</option>
                                        <c:forEach items="${YNMap}" var="item">
                                            <option value="${item.key}" ${not empty searchInfo && searchInfo.isStatBiz == item.key? 'selected' : '' }>${item.value}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label">查询biz名称：</label>
                                <div class="col-sm-2">
                                    <input type="text" name="bizName" onkeydown="if(event.keyCode==13){doRefresh();return false;}" id="bizName" class="form-control"
                                           placeholder="请输入biz名称" maxlength="30" value="${not empty searchInfo.bizName?searchInfo.bizName : ''}">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>seed统计项</h5>
                    <div class="ibox-tools">
                        <c:if test="${userType == 'super' || not empty btnMap['addSeed']}">
                            <button class="btn btn-primary btn-outline" onclick="openAddSeedPage()">新增</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['editSeed']}">
                            <button class="btn btn-primary btn-outline" onclick="openEditSeedPage()">编辑</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['delSeed']}">
                            <button class="btn btn-primary btn-outline" onclick="doDeleteSeed()">删除</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['importSeed']}">
                            <button class="btn btn-primary btn-outline" onclick="openImportPage()">导入</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['changeSeed']}">
                            <button class="btn btn-primary btn-outline" onclick="changeSeedState()" id="_btnChangeState">监控</button>
                        </c:if>
                        <button class="btn btn-primary btn-outline" type="submit" onclick="doRefresh()">刷新</button>
                    </div>
                </div>
                <div class="ibox-content">
                    <table class='table table-striped table-hover'
                           id="seedTable"
                           data-height="370"
                           data-toggle="table"
                           data-url="${ctx}/pvuv/statSeedBiz/pageFindSeedData?t=${now}"
                           data-pagination="true"
                           data-side-pagination="server"
                           data-striped="true"
                           data-response-handler="handleServerResult"
                           data-query-params-type=""
                           data-query-params="getLeftParams"
                           data-page-number="${not empty searchInfo.pageNoLeft?searchInfo.pageNoLeft:1}"
                           data-page-size="${not empty searchInfo.pageSizeLeft?searchInfo.pageSizeLeft:defaultPageSize}"
                           data-page-list="${pageList}">
                        <thead>
                        <tr>
                            <th data-field="id" data-visible="false">seedID</th>
                            <th data-field="isStat" data-align="center" data-formatter="formatIsStat" data-width="70px">是否监控</th>
                            <th data-field="seedId" data-align="center" data-width="90px">seedid</th>
                            <th data-field="name" data-align="center" data-width="150px" data-formatter="initCheck">seed名称</th>
                            <th data-field="sortNum" data-align="center" data-width="60px">排序</th>
                            <th data-field="remark" data-align="center" data-width="100px">描述</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-sm-6" style="padding-left: 0px;">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>统计子项</h5>
                    <div class="ibox-tools col-sm-offset-1">
                        <c:if test="${userType == 'super' || not empty btnMap['addSeedBiz']}">
                            <button class="btn btn-primary btn-outline" onclick="openAddBizPage()">新增</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['editSeedBiz']}">
                            <button class="btn btn-primary btn-outline" onclick="openEditBizPage()">编辑</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['delSeedBiz']}">
                            <button class="btn btn-primary btn-outline" onclick="doDeleteBiz()">删除</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['changeSeedBiz']}">
                            <button class="btn btn-primary btn-outline" onclick="changeBizState()" id="_btnBizChangeState">监控</button>
                        </c:if>
                        <button class="btn btn-primary btn-outline" type="submit" onclick="doRefreshBiz()">刷新</button>
                    </div>
                </div>
                <div class="ibox-content">
                    <table class='table table-striped table-hover'
                           id="bizTable"
                           data-height="370"
                           data-toggle="table"
                           data-url="${ctx}/pvuv/statSeedBiz/pageFindBizData?t=${now}"
                           data-pagination="true"
                           data-side-pagination="server"
                           data-striped="true"
                           data-response-handler="handleServerResult"
                           data-query-params-type=""
                           data-query-params="getRightParams"
                           data-page-number="${not empty searchInfo.pageNoRight?searchInfo.pageNoRight:1}"
                           data-page-size="${not empty searchInfo.pageSizeRight?searchInfo.pageSizeRight:defaultPageSize}"
                           data-page-list="${pageList}">
                        <thead>
                        <tr>
                            <th data-field="id" data-visible="false">bizID</th>
                            <th data-field="isStat" data-align="center" data-formatter="formatIsStat" data-width="70px">是否监控</th>
                            <th data-field="bizId" data-align="center" data-width="90px">bizid</th>
                            <th data-field="name" data-align="center" data-width="150px">biz名称</th>
                            <th data-field="seedName" data-align="center" data-width="120px">所属seed</th>
                            <th data-field="sortNum" data-align="center" data-width="60px">排序</th>
                            <th data-field="remark" data-align="center" data-width="100px">描述</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="text-center">${companyName}</div>
        </div>
    </div>
</div>
<script src="${ctx}/js/stat/statMgr.js?t=${now}"></script>
</body>
</html>

